package com.lapelife.backend.controller;

import com.lapelife.backend.common.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("test")
@Api(tags = "测试接口")
@CrossOrigin
public class TestController {

    @ApiOperation("你好")
    @PreAuthorize("hasAuthority('user:person')")
    @GetMapping("/hello")
    public ResponseResult<String> hello() {
        return ResponseResult.suc("Hello world!");
    }

    @ApiOperation("查询所有用户")
    @PreAuthorize("hasAuthority('system:user:list')")
    @GetMapping("/list")
    public ResponseResult<String> list() {
        return ResponseResult.suc("查询用户信息");
    }

    @ApiOperation("获取所有用户")
    @PreAuthorize("hasAuthority('system:user:all')")
    @GetMapping("/all")
    public ResponseResult<String> all() {
        return ResponseResult.suc("获取所有用户信息");
    }

}
